{% extends "master.html" %} {% block content_header_title%}个人中心{% end %} {% block content_body%}
<div class="row">
    <div class="col-md-12">
        <div class="box box-primary">
            <div class="box-body">
                <!-- form start -->
                <form role="form" id="profile-form">
                    {% module BoForm([form], ['个人资料'], form_layouts) %}
                    <input type="hidden" id="user_id" name="user_id" value="{{ form.user_id.data }}"/>
                    {% module xsrf_form_html() %}
                </form>
            </div>
        </div>
    </div>
    <div class="col-md-12">
        <button type="button" class="btn btn-primary pull-right" id="profile-btn">保存</button>
    </div>
</div>
{% end %} {% block footer%}
<script type="text/javascript">
    $(function() {
        $('#user_login').prop('readonly', true);
        $("#profile-btn").click(function() {
            var d = $("#profile-form").serialize();
            $.post('{{api("bo_profile_save")}}', d, function(rsp) {
                if (rsp.success) {
                    bo_alert_success("保存成功!")
                } else {
                    bo_valid_errors("profile-form", rsp.data, rsp.message);
                }
            }, "json");
        });
    });

</script>
{% end %}